<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jquery表单提交衣服尺寸选择勾选获取value值</title>
<meta name="description" content="jquery表单提交制作各大商城衣服尺寸选择勾选效果，点击购物车提交勾选尺寸value值。一款简单实用的衣服尺寸选择勾选效果。" />
</head>

<body>

<style type="text/css">
*{margin:0;padding:0;list-style-type:none;}
a{blr:expression(this.onFocus=this.blur())}/*去掉a标签的虚线框，避免出现奇怪的选中区域*/
body{background:#fff;font-size:12px;font-family:Helvetica,Arial,sans-serif,"宋体";color:#333;}
.clear{display:block; clear:both;}
.clearfix:after{content:"."; display:block; height:0; clear:both;visibility:hidden;}
*html .clearfix{height:1%;}
*+html .clearfix{height:1%;}
a{color:#333;text-decoration:none;}
a:hover{color:#990000;text-decoration:underline;}
/* choose */
.choose{width:260px;margin:100px auto 0 auto;border:solid 1px #ddd;padding:15px 30px 30px 30px;}
.choosetext{height:24px;padding:20px 0;font-size:14px;}
.choosebox{padding:0 0 35px 0;}
.choosebox li{float:left;margin-right:10px;display:inline;}
.choosebox li a{float:left;background:#fff;font-size:14px;border:1px solid #ccc;height:14px;line-height:14px;padding:4px 12px; display:block;}
.choosebox li a.current{background:url(images/right-icon.gif) no-repeat 100% 100%;border:1px solid #A10000;}
.choosebox li input{display:none;}
.choose .btn-img{width:160px;height:50px;overflow:hidden;background:url(images/cart.gif) no-repeat;cursor:pointer;border:0;}
.choose .btn-img span{display:block;font-size:18px;font-weight:800;color:#fff;font-family:"微软雅黑","宋体";padding:0 0 0 50px;line-height:50px;}
</style>

<div class="choose" id="dress-size">
	<form action="" method="get">
		<div class="choosetext">尺寸：<span>未选择</span></div>
		<div class="choosebox">
			<ul class="clearfix">
				<li>
					<input type="radio" name="name" value="S" id="" />
					<a href="javascript:void(0);" class="size_radioToggle"><span class="value">S</span></a>
				</li>
				<li>
					<input type="radio" name="name" value="M" id="" />
					<a href="javascript:void(0);" class="size_radioToggle"><span class="value">M</span></a>
				</li>
				<li>
					<input type="radio" name="name" value="L" id="" />
					<a href="javascript:void(0);" class="size_radioToggle"><span class="value">L</span></a>
				</li>
				<li>
					<input type="radio" name="name" value="XL" id="" />
					<a href="javascript:void(0);" class="size_radioToggle"><span class="value">XL</span></a>
				</li>
				<li>
					<input type="radio" name="name" value="XXL" id="" />
					<a href="javascript:void(0);" class="size_radioToggle"><span class="value">XXL</span></a>
				</li>
			</ul>
		</div>
		<div><button type="submit" class="btn-img"><span>放入购物车</span></button></div>
	</form>	
</div><!--choose end-->

<script type="text/javascript" src="http://www.jsfoot.com/skin/js/jquery.js"></script>	
<script type="text/javascript">
$(function(){   
	$('.choosebox li a').click(function(){
		var thisToggle = $(this).is('.size_radioToggle') ? $(this) : $(this).prev();
		var checkBox = thisToggle.prev();
		checkBox.trigger('click');
		$('.size_radioToggle').removeClass('current');
		thisToggle.addClass('current');
		return false;
	});		
});

$(".choosebox li a").click(function(){
	var text = $(this).html();
	$(".choosetext span").html(text);
	$("#result").html("" + getSelectedValue("dress-size"));
});
			
function getSelectedValue(id){
	return 
	$("#" + id).find(".choosetext span.value").html();
}
</script>
	
</body>
</html>